package com.apimarket.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * api接口实体类
 *
 * @author yyc
 */
@Data
public class ApiInterface {
    private String id;

//    @NotNull(message = "所属接口集id不能为空")
    private String serviceId;

//    @NotNull(message = "所属的route id不能为空")
    private String routeId;

    @NotNull(message = "接口名不能为空")
    private String name;

    //这里接口地址请求的服务器应该是kong所在的服务器，端口也应该是kong的url访问端口8000
//    @NotNull(message = "接口地址不能为空")
    private String url;

//    @NotNull(message = "响应格式不能为空")
    private String responseType;

//    @NotNull(message = "请求方法不能为空")
    private String method;

//    @NotNull(message = "请求样例不能为空")
    private String requestExample;

    private String remark;

    private String userId;

    //@NotNull(message = "日期不能为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date date;

    /*public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getServiceId() {
        return serviceId;
    }

    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getResponseType() {
        return responseType;
    }

    public void setResponseType(String responseType) {
        this.responseType = responseType;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getRequestExample() {
        return requestExample;
    }

    public void setRequestExample(String requestExample) {
        this.requestExample = requestExample;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }*/

    /*@Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("ApiInterface{");
        sb.append("id='").append(id).append('\'');
        sb.append(", serviceId='").append(serviceId).append('\'');
        sb.append(", name='").append(name).append('\'');
        sb.append(", url='").append(url).append('\'');
        sb.append(", responseType='").append(responseType).append('\'');
        sb.append(", method='").append(method).append('\'');
        sb.append(", requestExample='").append(requestExample).append('\'');
        sb.append(", remark='").append(remark).append('\'');
        sb.append(", userId='").append(userId).append('\'');
        sb.append(", date=").append(date);
        sb.append('}');
        return sb.toString();
    }*/
}